/*
 * Copyright (c) 2021.版权所有高金磊
 */

package 领扣算法.A简单题.可以形成最大正方形的矩形数目;

import org.python.modules.itertools.count;

public class Main {
    public int countGoodRectangles(int[][] rectangles) {
        int max=0;
        int count=0;
        int middle=0;
        for (int[] rectangle : rectangles) {
            middle=Math.min(rectangle[0],rectangle[1]);
            if (middle>max) {
                max = middle;
                count=1;
            }
            else if (middle==max){
                count++;
            }

        }
        return count;
    }
}
